import {
    x as y,
    r as H,
    c as le,
    i as t,
    o as b,
    a as q,
    m as e,
    l,
    e as c,
    T as J,
    O as $,
    P as z,
    U as M,
    Q as I,
    w as P,
    B as u,
    t as A,
    b as L,
    A as W,
    k as F,
    d as T,
    u as N,
    H as j
} from "./index-abba05ce.js";

const ae = {
        __name: "edit", emits: ["success", "close"], setup(O, {expose: x, emit: C}) {
            const V = C, w = y(null), r = y(null), m = y("add"),
                n = y({id: "", avatar: "", name: "", intro: "", weigh: 0, status: 1}), p = H({
                    name: [{required: !0, message: "请填写圈子名称", trigger: "blur"}],
                    intro: [{required: !0, message: "请填写圈子简介", trigger: "blur"}],
                    avatar: [{required: !0, message: "请上传一张圈子头像", trigger: "blur"}]
                }), U = le(() => m.value == "edit" ? "编辑圈子" : "新增圈子"), B = async i => {
                    if (m.value == "edit") {
                        const a = await $.circle.detail({id: i.id});
                        n.value = a.data
                    }
                }, K = (i = "add") => {
                    m.value = i, w.value.open()
                }, D = () => {
                    r.value.resetFields(), V("close")
                }, S = async () => {
                    var a;
                    await ((a = r.value) == null ? void 0 : a.validate());
                    let i;
                    m.value == "add" ? i = await $.circle.create(n.value) : i = await $.circle.update(n.value), i.error ? z.msgError(i.msg) : (D(), V("success"), z.msgSuccess(i.msg))
                };
            return x({open: K, setFormData: B}), (i, a) => {
                const s = t("la-uploader"), d = t("el-text"), k = t("el-form-item"), v = t("el-input"),
                    R = t("el-input-number"), h = t("el-radio"), _ = t("el-radio-group"), f = t("el-form");
                return b(), q("div", null, [e(J, {
                    ref_key: "dialogRef",
                    ref: w,
                    title: U.value,
                    async: !0,
                    onConfirm: S,
                    onCancel: D,
                    width: "750px"
                }, {
                    default: l(() => [e(f, {ref_key: "formRef", ref: r, model: n.value, "label-width": "84px", rules: p}, {
                        default: l(() => [e(k, {
                            label: "头像",
                            prop: "avatar"
                        }, {
                            default: l(() => [e(s, {
                                modelValue: n.value.avatar,
                                "onUpdate:modelValue": a[0] || (a[0] = g => n.value.avatar = g)
                            }, null, 8, ["modelValue"]), e(d, {
                                class: "mx-1",
                                size: "small"
                            }, {default: l(() => [c("最佳尺寸：1:1")]), _: 1})]), _: 1
                        }), e(k, {label: "名称", prop: "name"}, {
                            default: l(() => [e(v, {
                                modelValue: n.value.name,
                                "onUpdate:modelValue": a[1] || (a[1] = g => n.value.name = g),
                                maxlength: "20",
                                placeholder: "请填写",
                                "show-word-limit": ""
                            }, null, 8, ["modelValue"])]), _: 1
                        }), e(k, {label: "简介", prop: "intro"}, {
                            default: l(() => [e(v, {
                                modelValue: n.value.intro,
                                "onUpdate:modelValue": a[2] || (a[2] = g => n.value.intro = g),
                                type: "textarea",
                                maxlength: "200",
                                placeholder: "请填写",
                                "show-word-limit": ""
                            }, null, 8, ["modelValue"])]), _: 1
                        }), e(k, {label: "权重", prop: "weigh"}, {
                            default: l(() => [e(R, {
                                modelValue: n.value.weigh,
                                "onUpdate:modelValue": a[3] || (a[3] = g => n.value.weigh = g),
                                min: 0,
                                max: 1e4
                            }, null, 8, ["modelValue"]), e(d, {
                                class: "mx-1",
                                size: "small"
                            }, {default: l(() => [c("权重数值越大则排名越靠前")]), _: 1})]), _: 1
                        }), e(k, {label: "状态"}, {
                            default: l(() => [e(_, {
                                modelValue: n.value.status,
                                "onUpdate:modelValue": a[4] || (a[4] = g => n.value.status = g)
                            }, {
                                default: l(() => [e(h, {label: 1, border: ""}, {
                                    default: l(() => [c("正常（首页推送）")]),
                                    _: 1
                                }), e(h, {label: 2, border: ""}, {default: l(() => [c("正常")]), _: 1}), e(h, {
                                    label: 3,
                                    border: ""
                                }, {default: l(() => [c("下线")]), _: 1})]), _: 1
                            }, 8, ["modelValue"])]), _: 1
                        })]), _: 1
                    }, 8, ["model", "rules"])]), _: 1
                }, 8, ["title"])])
            }
        }
    }, te = {class: "mt-2"}, oe = {class: "d-flex justify-content-end mt-4"}, ne = {
        __name: "user", emits: ["success", "close"], setup(O, {expose: x, emit: C}) {
            const V = C, w = y("见闻间"), r = y(null), m = y(null), n = H({id: 0}), {
                pager: p,
                getLists: U,
                resetPage: B
            } = M({fetchFun: $.circle.user, params: n}), K = async i => {
                w.value = '"' + i.name + '"的成员', n.id = i.id, U()
            }, D = () => {
                r.value.open()
            }, S = () => {
                m.value.resetFields(), r.value.close(), V("close")
            };
            return x({open: D, setFormData: K}), (i, a) => {
                const s = t("el-avatar"), d = t("el-table-column"), k = t("el-tag"), v = t("el-table"),
                    R = t("la-pagination"), h = I("loading");
                return b(), q("div", null, [e(J, {
                    ref_key: "dialogRef",
                    ref: r,
                    title: w.value,
                    async: !0,
                    width: "1080px",
                    onConfirm: S,
                    showFooter: !1
                }, {
                    default: l(() => [P((b(), q("div", te, [e(v, {
                        data: u(p).lists,
                        size: "large",
                        "row-key": "id",
                        "default-expand-all": "",
                        stripe: "",
                        "header-cell-style": {background: "var(--el-bg-color-page)"}
                    }, {
                        default: l(() => [e(d, {
                            prop: "avatar",
                            label: "用户头像",
                            width: "90"
                        }, {
                            default: l(({row: _}) => [e(s, {size: 50, src: _.avatar}, null, 8, ["src"])]),
                            _: 1
                        }), e(d, {prop: "name", label: "昵称"}), e(d, {
                            prop: "gender",
                            label: "性别",
                            width: "100"
                        }, {
                            default: l(({row: _}) => [e(k, {type: _.gender == 0 ? "danger" : _.gender == 1 ? "primary" : "info"}, {
                                default: l(() => [c(A(_.gender == 0 ? "女" : _.gender == 1 ? "男" : "未知"), 1)]),
                                _: 2
                            }, 1032, ["type"])]), _: 1
                        }), e(d, {prop: "age", label: "年龄", width: "100"}), e(d, {
                            prop: "ip_str",
                            label: "IP属地"
                        }), e(d, {prop: "create_time", label: "加入时间", width: "180", sortable: ""})]), _: 1
                    }, 8, ["data", "header-cell-style"])])), [[h, u(p).loading]]), L("div", oe, [e(R, {
                        modelValue: u(p),
                        "onUpdate:modelValue": a[0] || (a[0] = _ => W(p) ? p.value = _ : null),
                        onChange: u(U)
                    }, null, 8, ["modelValue", "onChange"])])]), _: 1
                }, 8, ["title"])])
            }
        }
    }, se = {class: "admin-lists"}, re = {class: "d-flex justify-content-between"}, ie = {class: "mt-3"},
    de = {class: "d-flex justify-content-end mt-4"}, ce = {
        __name: "index", setup(O) {
            const x = y(null), C = y(!1), V = y(null), w = y(!1), r = H({status: 0, id: "", name: "", intro: ""}), {
                pager: m,
                getLists: n,
                resetPage: p,
                resetParams: U
            } = M({fetchFun: $.circle.list, params: r}), B = async a => {
                C.value = !0, await j(), await x.value.open(), await x.value.setFormData(a)
            }, K = async () => {
                w.value = !0, await j(), await V.value.open()
            }, D = async a => {
                w.value = !0, await j(), await V.value.open("edit"), await V.value.setFormData(a)
            }, S = async a => {
                await z.confirm("确定要删除吗？");
                const s = await $.circle.delete({id: a});
                s.error ? z.msgError(s.msg) : (z.msgSuccess(s.msg), n())
            }, i = (a, s) => {
                r.status = a.props.name, n()
            };
            return n(), (a, s) => {
                const d = t("el-tab-pane"), k = t("el-tabs"), v = t("el-button"), R = t("el-input"), h = t("el-form-item"),
                    _ = t("el-form"), f = t("el-table-column"), g = t("el-avatar"), Q = t("el-tag"), X = t("el-table"),
                    Y = t("la-pagination"), Z = t("el-card"), E = I("perms"), ee = I("loading");
                return b(), q("div", se, [e(k, {
                    modelValue: r.status,
                    "onUpdate:modelValue": s[0] || (s[0] = o => r.status = o),
                    class: "demo-tabs",
                    onTabClick: i
                }, {
                    default: l(() => [e(d, {label: "全部", name: 0}), e(d, {
                        label: "正常(首页推送)",
                        name: 1
                    }), e(d, {label: "正常", name: 2}), e(d, {label: "下架", name: 3})]), _: 1
                }, 8, ["modelValue"]), e(Z, {class: "border-none mt-2", shadow: "never"}, {
                    default: l(() => [L("div", re, [P((b(), F(v, {
                        icon: "Plus",
                        type: "primary",
                        onClick: K
                    }, {default: l(() => [c(" 新增 ")]), _: 1})), [[E, ["admin/dynamic.circle/create"]]]), e(_, {
                        model: r,
                        inline: ""
                    }, {
                        default: l(() => [e(h, {label: "ID", props: "id"}, {
                            default: l(() => [e(R, {
                                modelValue: r.id,
                                "onUpdate:modelValue": s[1] || (s[1] = o => r.id = o),
                                clearable: "",
                                onKeyup: T(u(p), ["enter"])
                            }, null, 8, ["modelValue", "onKeyup"])]), _: 1
                        }), e(h, {label: "名称", props: "name"}, {
                            default: l(() => [e(R, {
                                modelValue: r.name,
                                "onUpdate:modelValue": s[2] || (s[2] = o => r.name = o),
                                clearable: "",
                                onKeyup: T(u(p), ["enter"])
                            }, null, 8, ["modelValue", "onKeyup"])]), _: 1
                        }), e(h, {label: "简介", props: "intro"}, {
                            default: l(() => [e(R, {
                                modelValue: r.intro,
                                "onUpdate:modelValue": s[3] || (s[3] = o => r.intro = o),
                                clearable: "",
                                onKeyup: T(u(p), ["enter"])
                            }, null, 8, ["modelValue", "onKeyup"])]), _: 1
                        }), e(h, {style: {"margin-right": "0"}}, {
                            default: l(() => [e(v, {
                                type: "primary",
                                onClick: u(p),
                                icon: "Search"
                            }, {default: l(() => [c("查询")]), _: 1}, 8, ["onClick"]), e(v, {
                                onClick: u(U),
                                icon: "Refresh"
                            }, {default: l(() => [c("重置")]), _: 1}, 8, ["onClick"])]), _: 1
                        })]), _: 1
                    }, 8, ["model"])]), P((b(), q("div", ie, [e(X, {
                        data: u(m).lists,
                        size: "large",
                        "row-key": "id",
                        "default-expand-all": "",
                        stripe: "",
                        "header-cell-style": {background: "var(--el-bg-color-page)"}
                    }, {
                        default: l(() => [e(f, {prop: "id", label: "ID", width: "85"}), e(f, {
                            prop: "weigh",
                            label: "权重",
                            sortable: "",
                            width: "90"
                        }), e(f, {prop: "avatar", label: "头像", width: "85"}, {
                            default: l(({row: o}) => [e(g, {
                                size: 50,
                                src: o.avatar
                            }, null, 8, ["src"])]), _: 1
                        }), e(f, {prop: "name", label: "名称", width: "200"}), e(f, {
                            prop: "intro",
                            label: "简介",
                            "show-overflow-tooltip": ""
                        }), e(f, {
                            prop: "user_count",
                            label: "关注数",
                            width: "100",
                            sortable: ""
                        }, {
                            default: l(({row: o}) => [e(Q, {type: "info"}, {
                                default: l(() => [c(A(o.user_count), 1)]),
                                _: 2
                            }, 1024)]), _: 1
                        }), e(f, {prop: "browse", label: "浏览", width: "60"}), e(f, {
                            prop: "status",
                            label: "状态",
                            width: "150"
                        }, {
                            default: l(({row: o}) => [e(Q, {type: o.status == 3 ? "info" : "primary"}, {
                                default: l(() => [c(A(o.status == 1 ? "正常（首页推送）" : o.status == 2 ? "正常" : "下架"), 1)]),
                                _: 2
                            }, 1032, ["type"])]), _: 1
                        }), e(f, {prop: "create_time", label: "创建时间", width: "180", sortable: ""}), e(f, {
                            label: "操作",
                            width: "200",
                            fixed: "right"
                        }, {
                            default: l(({row: o}) => [o.user_count ? P((b(), F(v, {
                                key: 0,
                                link: "",
                                type: "success",
                                onClick: G => B(o)
                            }, {
                                default: l(() => [c(" 查看成员 ")]),
                                _: 2
                            }, 1032, ["onClick"])), [[E, ["admin/dynamic.circle/user"]]]) : N("", !0), P((b(), F(v, {
                                link: "",
                                type: "primary",
                                onClick: G => D(o)
                            }, {
                                default: l(() => [c(" 编辑 ")]),
                                _: 2
                            }, 1032, ["onClick"])), [[E, ["admin/dynamic.circle/update"]]]), P((b(), F(v, {
                                link: "",
                                type: "danger",
                                onClick: G => S(o.id)
                            }, {
                                default: l(() => [c(" 删除 ")]),
                                _: 2
                            }, 1032, ["onClick"])), [[E, ["admin/dynamic.circle/delete"]]])]), _: 1
                        })]), _: 1
                    }, 8, ["data", "header-cell-style"]), L("div", de, [e(Y, {
                        modelValue: u(m),
                        "onUpdate:modelValue": s[4] || (s[4] = o => W(m) ? m.value = o : null),
                        onChange: u(n)
                    }, null, 8, ["modelValue", "onChange"])])])), [[ee, u(m).loading]])]), _: 1
                }), w.value ? (b(), F(ae, {
                    key: 0,
                    ref_key: "editRef",
                    ref: V,
                    onSuccess: u(n),
                    onClose: s[5] || (s[5] = o => w.value = !1)
                }, null, 8, ["onSuccess"])) : N("", !0), C.value ? (b(), F(ne, {
                    key: 1,
                    ref_key: "userRef",
                    ref: x,
                    onClose: s[6] || (s[6] = o => C.value = !1)
                }, null, 512)) : N("", !0)])
            }
        }
    };
export {ce as default};
